home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Shutdown FX 2.1 / source / Fade module ƒ / ◊ Fades added in 2.1 / Left-right split.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.5 KB  |  93 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Left-right split.c
  4.  
  5. Purpose:    Graphic effect to fade main window to solid pattern.
  6.             See comments below for more description.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program in a file named "GNU General Public License".
  20. If not, write to the Free Software Foundation, 675 Mass Ave,
  21. Cambridge, MA 02139, USA.
  22.  
  23. \**********************************************************************/
  24.  
  25. #include "timing.h"
  26.  
  27. #define CorrectTime 2
  28. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  29. #define theWindowWidth (boundsRect.right-boundsRect.left)
  30.  
  31. pascal short main(Rect boundsRect, Pattern *thePattern);
  32.  
  33. pascal short main(Rect boundsRect, Pattern *thePattern)
  34. {
  35.     RgnHandle        topRgn, bottomRgn;
  36.     RgnHandle        topDestRgn, bottomDestRgn;
  37.     Rect            topRect, bottomRect;
  38.     short            iter;
  39.     short            offset;
  40.     
  41.     offset=5;
  42.     
  43.     topRgn=NewRgn();
  44.     OpenRgn();
  45.         MoveTo(0, 0);
  46.         LineTo(0, theWindowHeight);
  47.         LineTo(theWindowWidth, 0);
  48.         LineTo(0, 0);
  49.     CloseRgn(topRgn);
  50.     OffsetRgn(topRgn, boundsRect.left, boundsRect.top);
  51.     
  52.     bottomRgn=NewRgn();
  53.     OpenRgn();
  54.         MoveTo(theWindowWidth, theWindowHeight);
  55.         LineTo(theWindowWidth, 0);
  56.         LineTo(0, theWindowHeight);
  57.         LineTo(theWindowWidth, theWindowHeight);
  58.     CloseRgn(bottomRgn);
  59.     OffsetRgn(bottomRgn, boundsRect.left, boundsRect.top);
  60.     
  61.     topRect=bottomRect=boundsRect;
  62.     topRect.right=topRect.left+offset;
  63.     bottomRect.left=bottomRect.right-offset;
  64.     topDestRgn=NewRgn();
  65.     bottomDestRgn=NewRgn();
  66.     
  67.     for (iter=0; iter<theWindowWidth; iter+=offset)
  68.     {
  69.         StartTiming();
  70.         
  71.         RectRgn(topDestRgn, &topRect);
  72.         RectRgn(bottomDestRgn, &bottomRect);
  73.         SectRgn(topRgn, topDestRgn, topDestRgn);
  74.         SectRgn(bottomRgn, bottomDestRgn, bottomDestRgn);
  75.         FillRgn(topDestRgn, *thePattern);
  76.         FillRgn(bottomDestRgn, *thePattern);
  77.         
  78.         topRect.left+=offset;
  79.         topRect.right+=offset;
  80.         bottomRect.left-=offset;
  81.         bottomRect.right-=offset;
  82.         
  83.         TimeCorrection(CorrectTime);
  84.     }
  85.     
  86.     DisposeRgn(topRgn);
  87.     DisposeRgn(bottomRgn);
  88.     DisposeRgn(topDestRgn);
  89.     DisposeRgn(bottomDestRgn);
  90.     
  91.     return 0;
  92. }
  93.